package com.pxst.utils.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.pxst.plugins.HotClassLoader;

/** 
 * 热加载外部jar
* @author yangxy
* @version 创建时间：2023年8月16日 上午11:51:10 
*/
@Component
@EnableScheduling
public class LoadJarScheduled {
	@Value("${plug.url}")
	private String jarUrl;
	@Autowired
	private HotClassLoader hotClassLoader;
	
	@Scheduled(cron = "0/10 * * * * ?")
//	@Scheduled(cron = "0 30 16 * * ?")
	private void load() throws Exception {
		hotClassLoader.loadAllJar(jarUrl);
	}
}
